import pandas as pd

# 日期
line = '2025-08-05 00:00:00'
print(line[5:7])
print(pd.to_datetime(line).weekday())

print('----'*20)


# 原始数据
data = pd.DataFrame({'power_load': [100, 150, 200, 250, 300]})

'''
时间序列分析的核心工具: shift
shift(i) : 将数据沿时间轴向后平移 i 个时间步
'''
# 创建滞后特征（window_size=3）
window_size = 3
shift_list = [data['power_load'].shift(i) for i in range(1, window_size + 1)]
# print(shift_list)
# enumerate(..., start=1): 为滞后特征生成从1开始的序号
for i, shifted in enumerate(shift_list, start=1):
    data[f'lag_{i}'] = shifted

print(data)

# shift_data = pd.concat(shift_list, axis=1)
# result_data = pd.concat([data,shift_data],axis=1)
# print(result_data)